package org.totoro.boot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.totoro.boot.UserBean;
import org.totoro.boot.services.UserService;

/**
 * Created by Administrator on 2017/6/29.
 */
@RestController()
public class ClientController {


    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private UserService userService;


    @GetMapping("/index")
    public Object index(){

     //   UserBean forObject = restTemplate.getForObject("http://cloud-service/exec", UserBean.class);


        try {

            UserBean user = userService.findUser("你好我是测是数据");

            return user;

        }catch (Exception e){
            e.printStackTrace();
        }

        return "你好";
    }

}
